﻿<Window x:Class="_11.DataBinding.ExplictBinding"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:_11.DataBinding"
        Title="ExplictBinding" Height="114" Width="383">
    <Window.Resources>
        <local:Person x:Key="kgb" Name="KGB" Age="50"/>
        <local:Person x:Key="stasi" Name="stasi" Age="30"/>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="5"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="170*" />
            <ColumnDefinition Width="191*" />
        </Grid.ColumnDefinitions>
        <GroupBox Header="Person 1" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" Text="{Binding Source={StaticResource kgb}, Path=Name}"/>
                <!--note: long-hand version binding syntax-->
                <TextBlock Grid.Row="1">
                    <TextBlock.Text>
                        <Binding Source="{StaticResource kgb}" Path="Age"/> 
                    </TextBlock.Text>
                </TextBlock>
            </Grid>
        </GroupBox>
        <GroupBox Grid.Column="1" Header="Person 2" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" Text="{Binding Source={StaticResource stasi}, Path=Name}"/>
                <!--note: long-hand version binding syntax-->
                <TextBlock Grid.Row="1">
                    <TextBlock.Text>
                        <Binding Source="{StaticResource stasi}" Path="Age"/> 
                    </TextBlock.Text>
                </TextBlock>
            </Grid>
        </GroupBox>
    </Grid>
</Window>
